<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
        name="viewport">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="Cache-Control" content="no-transform" />
    <title>{{'CMS_SEOTITLE'|sysconfig}}</title>
    <meta name="keywords" content="{{'CMS_KEYWORDS'|sysconfig}}" />
    <meta name="description" content="{{'CMS_DESCRIPTION'|sysconfig}}" />
    <link rel="stylesheet" href="/static/css/style.css" media="all">
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/ad.js"></script>
</head>

<body>
    <script>
        site();
    </script>
    {% include "/index/common/header.html" %}
    <div id="tad">
        <script>
            tjs();
        </script>
    </div>
    <div class="box mt10">
        <div class="fl_640">
            <div class="r_two_column">
                <div class="r_one">
                    <div class="side">
                        <div class="stit">
                            <h2>简介</h2>
                            <div class="cl"></div>
                        </div>
                        <p class="i_des">于千万人之中遇见你所要遇见的人，没有早一步，也没有晚一步，刚巧碰上了，那也没有别的话可以说，唯有轻轻地问一声：“噢，你也在这里吗？”——<a
                                href="https://baike.baidu.com/item/张爱玲/44982">张爱玲百科</a></p>
                    </div>
                </div>

                <div class="r_one">
                    <div class="side">
                        <div class="stit">
                            <h2>人气排行</h2>
                            <div class="cl"></div>
                        </div>
                        <ul class="uli chs">{% for row in relate_tuijian_list %}<li>
                                <a
                                    href="{{row.id|getArticleDetailUrl}}">{{row.title }}</a>
                            </li>{% endfor %}</ul>
                        <div class="cl"></div>
                    </div>
                </div>
                <div class="cl"></div>
            </div>

            <div id="arclist">
                {% for row in list %}
                <div class="list">
                    {% if row.litpic %}
                    <a class="limg" href="{{row.id|getArticleDetailUrl}}">
                        <img alt="{{row.title}}" src="/static{{row.litpic}}">
                    </a>
                    {% endif %}
                    <strong class="tit"><a href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a></strong>
                    <p>{{row.description}}..</p>
                    <div class="info">
                        <span class="fl">
                            {% if row.writer %} 
                                <i>{{row.writer}}</i>
                            {% elif row.source %}
                                <i>{{row.source}}</i><em>{{row.update_time|date}}</em>
                        </span>
                        <span class="fr"><em>{{row.click}}</em>人阅读</span>
                        {% endif %}
                    </div> 
                    <div class="cl"></div>
                </div>{% endfor %} {% if list|length == 0 %}<div style="text-align:center;padding:20px;">暂无记录</div>{% endif %}</div>
            </div>

            <!-- fl_640 end -->

            <div class="fr_300">
                <div id="rad1">
                    <script>
                        rjs1();
                    </script>
                </div>
                <div class="side">
                    <div class="stit">
                        <div class="stith"><strong>热门话题</strong></div>
                        <div class="cl"></div>
                    </div>
                    <div class="ws-tag">{% for row in relate_tag_list %}
                        <a  href="{{row.id|getTagDetailUrl}}">{{ row.name}}</a>
                        {% endfor %}
                    </div>
                </div>

                <div class="side">
                    <div class="stit">
                        <h2>推荐阅读</h2><a href="javascript:getmore({limit:5,tuijian:1,mode:1,orderby:'rand'});"
                            class="more">换一换</a>
                        <div class="cl"></div>
                    </div>
                    <ul class="uli chs" id="xglist">{% for row in relate_tuijian_list %}
                        <li><a
                                href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                        </li>{% endfor %}</ul>
                    <div class="cl"></div>
                </div>

                <div class="side">
                    <div class="stit">
                        <h2>猜你喜欢</h2><a href="javascript:getmore({limit:5,mode:2,orderby:'rand'});" class="more">换一换</a>
                        <div class="cl"></div>
                    </div>
                    <div class="uli2" id="xglike">{% for row in relate_rand_list %}
                        <div class="suli">
                            {% if row.litpic %}
                            <a class="limg" href="{{row.id|getArticleDetailUrl}}">
                                <img alt="{{row.title}}" src="/static{{row.litpic}}">
                            </a>
                            {% endif %}
                            <a  href="{{row.id|getArticleDetailUrl}}">{{row.title}}</a>
                            <div class="sulii">
                                {% if row.writer %}
                                <span class="time">{{row.writer}}</span>
                                {% elif row.source %} 
                                <span class="time">{{row.source}}</span>
                                {% endif %} 
                                阅读({{ row.click}})</div>
                            <div class="cl"></div>
                        </div>{% endfor %}
                    </div>
                </div>

                <div class="side">
                    <div class="stit">
                        <div class="stith"><strong>友情链接</strong></div>
                        <div class="cl"></div>
                    </div>
                    <div class="rtags mt10">
                        {% for row in friendlink_list %}
                            <a  href="{{row.url}}">{{row.name}}</a>
                        {% endfor %}
                    </div>
                </div>

                <div id="rad2">

                </div>
            </div><!-- fr_300 end -->
        </div>
    </div><!-- box end -->
    <script>
        function getmore(condition) {
            var url = "{{'CMS_BASEHOST'|sysconfig}}/api/article/index";
            //var typeid = "";
            $.post(url, condition, function (res) {
                if (res.code == 0) {
                    var json = res.data.list; //数组
                    var str = '';
                    console.log(res.data)
                    $.each(json, function (index) {
                        //循环获取数据
                        //var title = json[index].title;
                        if (condition.mode == 1) {
                            str = str +
                                '<li><a href=" {{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title + '</a></li>';
                        } else if (condition.mode == 2) {
                            var litpic = '';
                            if (json[index].litpic !== '') {
                                litpic =
                                    '<a class="limg" href="{{getArticleDetailUrl}}' +
                                    json[index].id + '"><img alt="' + json[index].title + '" src="/static' +
                                    json[index].litpic + '"></a>';
                            }
                            str = str + '<div class="suli">' + litpic +
                                '<a href="{{getArticleDetailUrl}}' +
                                json[index].id + '">' + json[index].title +
                                '</a><div class="sulii">阅读(' + json[index].click +
                                ')</div><div class="cl"></div></div>';
                        }
                    });

                    if (str != '' && str != null && condition.mode == 1) {
                        $('#xglist').html(str);
                    } else if (str != '' && str != null && condition.mode == 2) {
                        $('#xglike').html(str);
                    }
                } else {

                }
            }, 'json');
        }

        $(function () {
            var ajaxload = false;
            var maxpage = false;
            var startpage = 1;
            var totalpage = {{totalpage}};

            var tmp_url = window.location.href;
            msg = tmp_url.split("#");
            tmp_url = msg[0];

            $(window).scroll(function () {
                var listheight = $("#arclist").outerHeight();

                if ($(document).scrollTop() + $(window).height() >= listheight) {
                    if (startpage >= totalpage) {
                        //$("#submit_bt_one").html("已是最后一页，没有更多数据");
                        return false;
                    }

                    if (!ajaxload && !maxpage) {
                        ajaxload = true;
                        //$("#submit_bt_one").html("努力加载中...");
                        var url = tmp_url;
                        var nextpage = startpage + 1;

                        $.get(url, {
                            page_ajax: 1,
                            page: nextpage
                        }, function (res) {
                            if (res) {
                                $("#arclist").append(res);
                                startpage++;

                                if (startpage >= totalpage) {
                                    maxpage = true;
                                    //$("#submit_bt_one").html("已是最后一页，没有更多数据");
                                    $("#arclist").append(
                                        '<div style="text-align:center;padding:20px;">暂无记录</div>'
                                        );
                                } else {
                                    //$("#submit_bt_one").html("点击加载更多");
                                }

                                ajaxload = false;
                            } else {
                                //$("#submit_bt_one").html("请求失败，请稍后再试");
                                ajaxload = false;
                            }
                        }, 'json');
                    }
                }
            });
        });
    </script>
    {% include "/index/common/footer.html" %}
</body>

</html>